import { request } from "@/utils";


//获取频道列表
export function getChannelListAPI() {
    return request({
        url: "/channels",
        method: "GET",
    });
}

//新增文章
export function addArticleAPI(data) {
    return request({
        url: "/mp/articles?draft=false",
        method: "POST",
        data
    });
}

//获取文章列表
export function getArticleListAPI(params) {
    return request({
        url: "/mp/articles",
        method: "GET",
        params
    });
}

//删除文章/mp/articles/{target}
export function deleteArticleAPI(id) {
    return request({
        url: `/mp/articles/${id}`,
        method: "DELETE",
    });
}

//获取文章详情 /mp/articles/{target}
export function getArticleAPI(id) {
    return request({
        url: `/mp/articles/${id}`,
        method: "GET",
    });
}

//更新文章接口
export function updateArticleAPI(data) {
    return request({
        url: `/mp/articles/${data.id}?draft=false`,
        method: "PUT",
        data
    })
}